<script setup lang="ts">
import slide1 from "@@/assets/images/layouts/1.jpg"
import slide2 from "@@/assets/images/layouts/2.jpg"
import logoUrl from "@@/assets/images/layouts/logo.png"
import thumbnail_3 from "@@/assets/images/layouts/thumbnail_3.png"

// import pkg from '/package.json'
import { onBeforeMount, onMounted, ref, shallowReactive } from "vue"
import { articleDetailApi } from "@/api"
import { useUserStore } from "@/pinia/stores/user.ts"
import Swiper from "./Swiper.vue"
import {removeToken} from "@@/utils/cache/cookies.ts";

const userStore = useUserStore()
const token = ref("")
const username = ref("")
const route = useRoute()
const images = ref<any[]>([])
function loadImages() {
  const imgs = [slide1, slide2, slide1, slide2, slide1, slide2]
  for (let i = 1; i <= 6; i++) {
    // console.log(imgs[i - 1])
    images.value.push({
      title: `image-${i}`,
      link: `#`,
      src: `${imgs[i - 1]}`
    })
  }
}
onBeforeMount(() => {
  console.log("route.params")
  console.log(route.params.id)
  username.value = userStore.getUserName().value
  token.value = userStore.token
  // 组件已完成响应式状态设置，但未创建DOM节点
  loadImages()
})
function logout() {
  token.value = ""
  username.value = ""
  removeToken()
  userStore.setToken("") // token-admin
  userStore.setUsername("")
}
const navigation = shallowReactive<{ [key: string]: any }>({})
function onBroadcastSwiper(swiper: any) {
  navigation.prevEl = swiper.navigation.prevEl
  navigation.prevEl.style.display = "block"
  navigation.nextEl = swiper.navigation.nextEl
  navigation.nextEl.style.display = "block"
}
</script>
<template>
  <div class="container_info">
    <Flex vertical gap="middle">
      <Swiper
        :images="images"
        mode="broadcast"
        :effcect="fade"
        :pauseOnMouseEnter="true"
        :pagination="{
          dynamicBullets: true,
          clickable: true
        }"
        :height="320"
        :slides-per-view="1"
        :loop="true"
        :space-between="300"
        navigation
        mousewheel
        @swiper="onBroadcastSwiper"
      />
    </Flex>
  </div>
</template>

<style>
.el-carousel__item .carousel,
.el-carousel__item .carousel img {
  display: block;
  width: 100%;
  height: 100%;
}
.container_info {
  width: 100%;
  background: repeat center center / 100%;
}
.header {
  width: 100%;
  height: 64px;
  background: #fff;
}
.header .header-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}
.container_info .header .header-content .logo {
  width: 100px;
  height: 50px;
  line-height: 50px;
  padding: 0 10px;
}
.nav ul li:after {
  display: block;
  content: "";
  width: 50px;
  height: 4px;
  position: absolute;
  left: 50%;
  bottom: -5px;
  margin-left: -25px;
  border-radius: 2px;
}
.active1:after {
  background-color: #20d5a8;
}
.nav {
  width: 700px;
  display: flex;
  padding: 0 10px;
  flex-direction: row;
  height: 50px;
  color: #0e0e0e;
}
.nav ul {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
}
.module-container {
  width: 65vw;
  margin: 0 auto;
}
.list1-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  gap: 0 32px;
}
.list1-box .item {
  width: 276px;
  height: 414px;
  border-radius: 16px;
  background: #ffffff;
  padding: 16px;
  box-sizing: border-box;
  overflow: hidden;
  cursor: pointer;
}
.list1-box .img1 {
  width: 244px;
  height: 122px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.list1-box .row1 {
  color: #333;
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list1-box .row2 {
  color: #333;
  font-size: 18px;
  height: 184px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 7;
  line-height: 26px;
}
.list1-box .item {
  width: 276px;
  height: 414px;
  border-radius: 16px;
  background: #ffffff;
  padding: 16px;
  box-sizing: border-box;
  overflow: hidden;
  cursor: pointer;}
.info-content {
  width: 100%;
}
.module-two {
  margin-bottom: 100px;
  display: flex;
  justify-content: space-between;
}
.footer .footer-content {
  width: 1520px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
}
.info-content .right .check-box {
  margin-top: 24px;
  width: 100%;
  padding: 16px;
  border-radius: 16px;
  background: #ffffff;
  display: flex;
  align-content: center;
  flex-wrap: wrap;
  gap: 24px 18px;
  font-size: 16px;
}
.user {
  width: 160px;
}
.info-content .right .check-box .el-checkbox {
  height: auto;
  margin-right: 0;
}
.info-content .right .hot-box {
  margin-top: 12px;
  width: 100%;
  padding: 16px;
  border-radius: 16px;
  background: #ffffff;
  max-height: 400px;
  overflow-y: auto;
}
.info-content .right{
  width: 276px;
}
.info-content .left .list2-box .item{
  margin-bottom: 8px;
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 207px;
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  padding: 16px;
  box-sizing: border-box;
}
.info-content .left .list2-box .item .left .img1 {
  width: 176px;
  height: 100%;
  border-radius: 8px;
  margin-right: 16px;
}
.info-content .left .list2-box .item .left .center .row1 {
  font-family: Source Han Sans;
  font-size: 18px;
  font-weight: 500;
  color: #333;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 12px;
}
.info-content .left .list2-box .item .left .center .row2 {
  font-size: 14px;
  color: #666;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  text-overflow: ellipsis;
}
.info-content .left .list2-box .item .left .center .row3 {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
}
.info-content .left .list2-box .item .left .center .row3 .text1 {
  font-size: 12px;
  color: #666;
  padding-right: 16px;
  margin-right: 16px;
  border-right: 1px solid #e0e0e0;
}
.info-content .left .list2-box .item .left .center .row3 .text1 {
  font-size: 12px;
  color: #666;
  padding-right: 16px;
  margin-right: 16px;
  border-right: 1px solid #e0e0e0;
}
.info-content .left .list2-box .item .left .center .row3 .text1:nth-last-child(1) {
  border-right: none;
  padding-right: 0;
  margin-right: 0;
}
.info-content .left .list2-box .item .left {
  flex: 1;
  display: flex;
  align-items: stretch;
}
.footer .footer-content {
  width: 1520px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
}
.footer h6 {
  font-family: xiaomi;
  font-size: 14px;
  color: #000;
  line-height: 19px;
  margin-top: 31px;
}
.footer p {
  font-family: xiaomi;
  font-size: 14px;
  color: #000;
  line-height: 19px;
  margin-top: 13px;
  cursor: pointer;
}
.footer .footer-content {
  width: 1520px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
}
.info-content .right .hot-box .row2 .text2 {
  flex: 1;
  font-size: 18px;
  color: #333;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list1-box .item {
  width: 276px;
  height: 414px;
  border-radius: 16px;
  background: #ffffff;
  padding: 16px;
  box-sizing: border-box;
  overflow: hidden;
  cursor: pointer;
}
.list1-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  gap: 0 32px;
}
.module-container {
  width: 65vw;
  margin: 0 auto;
}
.footer .footer-content {
  width: 1520px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
}
.w-1200 {
  width: 80vw !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
.footer .qcode img {
  display: block;
  width: 110px;
  height: 110px;
}
.footer .footer-content {
  width: 1520px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
}
.footer {
  border-top: 2px solid rgba(0, 0, 0, .25);
}
.info-content .left .list2-box .item {
  margin-bottom: 8px;
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 207px;
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  padding: 16px;
  box-sizing: border-box;
}
.info-content .right {
  width: 276px;
}
.info-content .left .list2-box .item .right .row1 {
  font-size: 18px;
  font-weight: 500;
  color: #333;
  margin-bottom: 24px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.info-content .left .list2-box .item .left .center {
  height: 100%;
  flex: 1;
  padding-right: 16px;
  margin-right: 16px;
  border-right: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
}
.nav ul li.active1 a {
  color: #20d5a8;
}
.nav ul li a {
  font-family: xiaomi;
  font-size: 18px;
  color: #000;
  line-height: 24px;
  cursor: pointer;
  text-decoration: none;
}
.nav ul li:after {
  display: block;
  content: "";
  width: 50px;
  height: 4px;
  position: absolute;
  left: 50%;
  bottom: -5px;
  margin-left: -25px;
  border-radius: 2px;
}
.nav ul li {
  position: relative;
}
.isLogin .avatar-dropdown .avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.isLogin .avatar-dropdown .avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 15px;
}
.isLogin .avatar-dropdown {
  display: flex;
  align-items: center;
  position: relative;
}
.isLogin .nikename {
  font-family: xiaomi;
  font-size: 18px;
  color: #000;
  line-height: 24px;
}
</style>
